﻿//////////////////////////////////////////////////////////////////////////////
//
// Copyright © 1998-2024 Glodon Company Limited.
//
// Licensed under the MIT License
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the “Software”),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
// sell copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
//////////////////////////////////////////////////////////////////////////////
#pragma once

#include <vector>
#include <map>
#include "Coordinate3d.h"

namespace gcmp
{
    class IModelLine;
    class IStructureSlopeLine;

    class StructureEditProfileUtils
    {
    public:
        // 检查轮廓线是否合法，并做提示
        static bool CheckForValidLoops(const std::vector<gcmp::IModelLine*>& modelLines, const gcmp::Coordinate3d& coord, bool supportMultiProfile, bool supportInnerLoop);
        
        // 检查屋顶坡度线和屋顶轮廓线相对关系的合法性
        // Rule 1:坡度线的起点必须在轮廓线上
        // Rule 2:一条坡度线必须在且只能在一条屋顶轮廓线上
        // Rule 3:一条屋顶轮廓线最多对应一条坡度线
        // Rule 4:不能同时在屋顶轮廓线和屋顶坡度线上定义坡度
        static bool CheckSlopeLineAndProfileCurveRelationshipValidity(std::vector<IStructureSlopeLine*>& slopeLines,
            std::vector<IModelLine*>& profileCurves,
            std::map<IStructureSlopeLine*, IModelLine*>& slopeLineAndProfileCurveMap);
    };
}
